import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-07-23
 * Time: 8:52
 */
public class Test {
    public static List<List<Integer>> yanghuisanjiao(int numRows){
        List<List<Integer>> ret = new ArrayList<>();
        List<Integer> list = new ArrayList<>();
        list.add(1);
        ret.add(list);
        for (int i = 1; i < numRows; i++) {
            List<Integer> curRow = new ArrayList<>();
            curRow.add(1);
            List<Integer> prevR = ret.get(i-1);
            for (int j = 1; j <i ; j++) {
                curRow.add(prevR.get(j)+prevR.get(j-1));
            }
            curRow.add(1);
            ret.add(curRow);
        }
        return ret;
    }
    public static void main(String[] args) {
        List<List<Integer>> t =yanghuisanjiao(5);
        System.out.println(t);

    }
}
